<template>
  <el-button type="primary"
             @click="handleReload">Key初始化</el-button>
  <avue-form :key="reload"
             :option="option"></avue-form>
</template>
<script>
export default {
  data () {
    return {
      reload: Math.random(),
      option: {
        border: true,
        align: 'center',
        menuAlign: 'center',
        column: [
          {
            label: '姓名',
            prop: 'name'
          }, {
            label: '性别',
            prop: 'sex'
          }, {
            label: '省份',
            prop: 'province',
            type: 'select',
            props: {
              label: 'name',
              value: 'code'
            },
            dicUrl: `https://cli.avuejs.com/api/area/getProvince`,
            rules: [
              {
                required: true,
                message: '请选择省份',
                trigger: 'blur'
              }
            ]
          }]
      }
    }
  },
  methods: {
    handleReload () {
      this.reload = Math.random();
      this.$message.success('初始化完成')
    }
  }
}
</script>